<?php
/**
 * Created by PhpStorm.
 * User: 赵震
 * Date: 2016/7/19
 * Time: 17:42
 */
/**
drop table if exists {$PREFIX}server;

drop table if exists {$PREFIX}server_log;

/*==============================================================*/
/* Table: {$PREFIX}server                                       */
/*==============================================================*/
create table {$PREFIX}server
(
    ServerID             int(11) unsigned not null auto_increment,
   Name                 char(255) not null,
   GroupName            char(255) not null,
   WANIP                int(11) not null,
   LANIP                int(11) not null,
   TotalCPUCore         int(11) not null,
   TotalMemory          int(11) not null,
   RegistTime           int(11) not null,
   SecretKey            text not null,
   primary key (ServerID)
);

/*==============================================================*/
/* Table: {$PREFIX}server_log                                   */
/*==============================================================*/
create table {$PREFIX}server_log
(
    LogID                int(11) unsigned not null auto_increment,
   ServerID             int(11) unsigned not null,
   TypeID               int(11) unsigned not null comment '内存、磁盘、CPU、网络',
   Value                int(11) not null,
   Time                 int(11) unsigned not null,
   primary key (LogID)
);

alter table {$PREFIX}server_log add constraint FK_Reference_1 foreign key (ServerID)
      references {$PREFIX}server (ServerID) on delete restrict on update restrict;

 */